package cn.tedu.kcircle.passport.infra.persist;

import cn.tedu.kcircle.passport.dao.mapper.UserMapper;
import cn.tedu.kcircle.passport.infra.converter.PassportInfraConverter;
import cn.tedu.kcircle.passport.repository.model.UserLoginInfoModel;
import cn.tedu.kcircle.passport.repository.model.UserRegisterModel;
import cn.tedu.kcircle.passport.repository.persist.UserRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

@Repository
@AllArgsConstructor
public class UserRepositoryImpl implements UserRepository {
    private UserMapper userMapper;
    private PassportInfraConverter converter;

    @Override
    public UserLoginInfoModel getLoginInfoByUsername(String username) {
        return userMapper.getLoginInfoByUsername(username);
    }

    @Override
    public int insert(UserRegisterModel userRegisterModel) {
        return userMapper.insert(converter.model2DO(userRegisterModel));
    }
}
